package com.huike.web.controller.report;


import com.huike.report.domain.vo.IndexBaseInfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huike.common.core.domain.AjaxResult;
import com.huike.report.service.IReportService;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

@RestController
@RequestMapping("/index")
public class IndexController {


    @Autowired
    private IReportService reportService;

    @GetMapping("/businessChangeStatistics")
    public AjaxResult businessChangeStatistics (@RequestParam("beginCreateTime") String beginCreateTime,
                                                @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.businessChangeStatistics(beginCreateTime,endCreateTime));
    }

    /**
     * 龙虎榜线索
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */
    @GetMapping("/salesStatistic")
    public AjaxResult salesStatistic(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.salesStatistic(beginCreateTime,endCreateTime));
    }

    /**
     * 首页--基础数据统计
     * @param beginCreateTime
     * @param endCreateTime
     * @return
     */

    @GetMapping("/getBaseInfo")
    public AjaxResult getBaseInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
//        IndexBaseInfoVO baseInfo = completableFuture.get();
        return AjaxResult.success(reportService.getBaseInfo(beginCreateTime, endCreateTime));
    }


    @GetMapping("/getTodoInfo")
    public AjaxResult getTodoInfo(@RequestParam("beginCreateTime") String beginCreateTime,
                                  @RequestParam("endCreateTime") String endCreateTime){
        return AjaxResult.success(reportService.selectCount4(beginCreateTime,endCreateTime));
    }

    @GetMapping("/getTodayInfo")
    public AjaxResult getTodoInfo(){
        return AjaxResult.success(reportService.selectCount5());
    }

//    @GetMapping("/getTodayInfo")
//    public AjaxResult getTodoInfo(){
//        return AjaxResult.success(reportService.selectCount4(,));
//    }


}